API: Log usage of various deprecated features
authorBrad Jorsch <bjorsch@wikimedia.org>
Thu, 14 Aug 2014 18:15:23 +0000 (14:15 -0400)
committerKunal Mehta <legoktm@gmail.com>
Thu, 14 Aug 2014 23:51:14 +0000 (16:51 -0700)
This will let us know how aggressively we can finally remove these.

Change-Id: I03fab36e921807e74fbabfa878756af254d89a1b

includes/api/ApiDelete.php
includes/api/ApiEditPage.php
includes/api/ApiExpandTemplates.php
includes/api/ApiHelp.php
includes/api/ApiMove.php
includes/api/ApiProtect.php
includes/api/ApiQueryLangLinks.php
includes/api/ApiQueryStashImageInfo.php
includes/api/ApiQueryUserContributions.php
includes/api/ApiUpload.php
includes/api/ApiWatch.php

index f26d58b..aab0303 100644 (file)
@@ -72,8 +72,10 @@ class ApiDelete extends ApiBase {
 
                // Deprecated parameters
                if ( $params['watch'] ) {
+                       $this->logFeatureUsage( 'action=delete&watch' );
                        $watch = 'watch';
                } elseif ( $params['unwatch'] ) {
+                       $this->logFeatureUsage( 'action=delete&unwatch' );
                        $watch = 'unwatch';
                } else {
                        $watch = $params['watchlist'];
index fff061f..9126ad3 100644 (file)
@@ -309,8 +309,10 @@ class ApiEditPage extends ApiBase {
 
                // Deprecated parameters
                if ( $params['watch'] ) {
+                       $this->logFeatureUsage( 'action=edit&watch' );
                        $watch = true;
                } elseif ( $params['unwatch'] ) {
+                       $this->logFeatureUsage( 'action=edit&unwatch' );
                        $watch = false;
                }
 
index c2cec6d..8a3b534 100644 (file)
@@ -42,6 +42,7 @@ class ApiExpandTemplates extends ApiBase {
                $this->requireMaxOneParameter( $params, 'prop', 'generatexml' );
 
                if ( $params['prop'] === null ) {
+                       $this->logFeatureUsage( 'action=expandtemplates&!prop' );
                        $this->setWarning( 'Because no values have been specified for the prop parameter, a ' .
                                'legacy format has been used for the output. This format is deprecated, and in ' .
                                'the future, a default value will be set for the prop parameter, causing the new' .
@@ -70,6 +71,10 @@ class ApiExpandTemplates extends ApiBase {
                $retval = array();
 
                if ( isset( $prop['parsetree'] ) || $params['generatexml'] ) {
+                       if ( !isset( $prop['parsetree'] ) ) {
+                               $this->logFeatureUsage( 'action=expandtemplates&generatexml' );
+                       }
+
                        $wgParser->startExternalParse( $title_obj, $options, OT_PREPROCESS );
                        $dom = $wgParser->preprocessToDom( $params['text'] );
                        if ( is_callable( array( $dom, 'saveXML' ) ) ) {
index b0b8328..bcd6c12 100644 (file)
@@ -51,6 +51,7 @@ class ApiHelp extends ApiBase {
                }
 
                if ( is_array( $params['querymodules'] ) ) {
+                       $this->logFeatureUsage( 'action=help&querymodules' );
                        $queryModules = $params['querymodules'];
                        foreach ( $queryModules as $m ) {
                                $modules[] = 'query+' . $m;
index cc58573..602a905 100644 (file)
@@ -134,8 +134,10 @@ class ApiMove extends ApiBase {
                        $watch = $params['watchlist'];
                } elseif ( $params['watch'] ) {
                        $watch = 'watch';
+                       $this->logFeatureUsage( 'action=move&watch' );
                } elseif ( $params['unwatch'] ) {
                        $watch = 'unwatch';
+                       $this->logFeatureUsage( 'action=move&unwatch' );
                }
 
                // Watch pages
index 828fc22..844d1cc 100644 (file)
@@ -102,6 +102,9 @@ class ApiProtect extends ApiBase {
 
                $cascade = $params['cascade'];
 
+               if ( $params['watch'] ) {
+                       $this->logFeatureUsage( 'action=protect&watch' );
+               }
                $watch = $params['watch'] ? 'watch' : $params['watchlist'];
                $this->setWatch( $watch, $titleObj, 'watchdefault' );
 
index d04e5b4..da05f27 100644 (file)
@@ -50,6 +50,7 @@ class ApiQueryLangLinks extends ApiQueryBase {
                // Handle deprecated param
                $this->requireMaxOneParameter( $params, 'url', 'prop' );
                if ( $params['url'] ) {
+                       $this->logFeatureUsage( 'prop=langlinks&llurl' );
                        $prop = array( 'url' => 1 );
                }
 
index d7904d4..db92856 100644 (file)
@@ -47,6 +47,7 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo {
 
                // Alias sessionkey to filekey, but give an existing filekey precedence.
                if ( !$params['filekey'] && $params['sessionkey'] ) {
+                       $this->logFeatureUsage( 'prop=stashimageinfo&siisessionkey' );
                        $params['filekey'] = $params['sessionkey'];
                }
 
index b8b4e31..4b167b8 100644 (file)
@@ -224,6 +224,7 @@ class ApiQueryContributions extends ApiQueryBase {
 
                $show = $this->params['show'];
                if ( $this->params['toponly'] ) { // deprecated/old param
+                       $this->logFeatureUsage( 'list=usercontribs&uctoponly' );
                        $show[] = 'top';
                }
                if ( !is_null( $show ) ) {
index 31816d6..368e7ce 100644 (file)
@@ -52,6 +52,7 @@ class ApiUpload extends ApiBase {
 
                // Copy the session key to the file key, for backward compatibility.
                if ( !$this->mParams['filekey'] && $this->mParams['sessionkey'] ) {
+                       $this->logFeatureUsage( 'action=upload&sessionkey' );
                        $this->mParams['filekey'] = $this->mParams['sessionkey'];
                }
 
@@ -604,6 +605,7 @@ class ApiUpload extends ApiBase {
 
                // Deprecated parameters
                if ( $this->mParams['watch'] ) {
+                       $this->logFeatureUsage( 'action=upload&watch' );
                        $watch = true;
                }
 
index 43ff4ec..8060260 100644 (file)
@@ -84,6 +84,7 @@ class ApiWatch extends ApiBase {
                                );
                        }
 
+                       $this->logFeatureUsage( 'action=watch&title' );
                        $title = Title::newFromText( $params['title'] );
                        if ( !$title || !$title->isWatchable() ) {
                                $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) );